/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by:   焦质晔
 * @Last Modified time: 2019-06-20 15:45:00
 */
import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 维修类型 - 下拉框
export const getWxlxSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedataRepairtypes/findAllRepairType`, {
    params
  });

// 工时单价 - 下拉框
export const getGsdjSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedataRepairtypes/labourpriceItem`, {
    params
  });

// 保险公司 - 下拉框
export const getBxgsSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/basedata/insuranceCo/insurance/dicts`, {
    params
  });

// 品牌 - 下拉框
export const getPinpSelect = params =>
  axios.get(`/api/basedata/vehicleProduct/brandsqueryall`, {
    params
  });

// 车系 - 下拉框
export const getChexSelect = (id, params) =>
  axios.get(`/api/basedata/vehicleProduct/brandsdict/${id}/seriessdict`, {
    params
  });

// 车型 - 下拉框
export const getCheModelSelect = (brandId, id, params) =>
  axios.get(`/api/basedata/vehicleProduct/brandsdict/${brandId}/seriessdict/${id}/modelsdict`, {
    params
  });
// 项目车型组 - 下拉框
export const getXmcxzSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/findProjectModelList`, {
    params
  });

// 工种 - 下拉框
export const getGongzSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/querytechnicianWorkType/item`, {
    params
  });

// 维修项目列表
export const getWxproductList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/findRepairProjectList`, {
    params
  });

// 维修项目类型 - 下拉框
export const getWxtypeSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryRepairType`, {
    params
  });

// 维修备件列表
export const getWxpjList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/findRepairProjectItem`, {
    params
  });

// 主分类名称 - 下拉框
export const getZflmcSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/findMainGroup`, {
    params
  });

// 维修项目是否存在 - 检查
export const isWxxmCheck = (id1, id2, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/queryModelLabourAllEntity/${id1}/${id2}`, {
    params
  });

// 项目维修列表
export const getWxxmList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/findProjectModelList`, {
    params
  });

// 收费类别 - 下拉框
export const getSflbSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryFee`, {
    params
  });

// 收费区分 - 下拉框
export const getSfqfSelect = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/chargeDifferentiationList`, {
    params
  });

// 收费类别 - 列表
export const getSflbList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairEstimate/queryFees`, {
    params
  });

// 车辆搜索列表
export const getClssList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/license`, {
    params,
    timeout: 60000
  });

// 新增维修项目记录
export const addWxxmRecord = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairProject/addLabour`, params);

// 查询建议维修项目(选项卡)
export const getJYXM = (row, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryRoAdviceByRoNO/${row}`, {
    params
  });

// 根据itemCode 查询系统基本参数
export const getSystemDefault = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/querySystemDefaultInfo`, {
    params
  });

// 工单用户增加锁定人   tabName:TT_REPAIR_ORDER, field:RO_NO,val:工单号
export const lockUser = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/updateByLocker`, {
    params
  });

// 工单用户解锁 val：工单号，tabName：TT_REPAIR_ORDER，field：RO_NO
export const unLockerUser = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/updateUnLocker`, {
    params
  });

// 工单打印信息
export const getRepairOrderPrintInfo = (roNo, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryPrintInfo/${roNo}`, {
    params
  });
// 工单合并打印信息
export const getRepairOrderHBPrintInfo = (roNo, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/queryHbPrintInfo/${roNo}`, {
    params
  });
// 工单合并打印信息
export const getRoLabourDtls = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/getRoLabourDtls`, { params });

// 查询维修类型(参数typeCode)
export const getRepairTypeData = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedataRepairtypes/queryItem`, {
    params
  });

// 查询所有员工
export const getDealerUser = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getDealerUser`);

// R3首保权益查询
export const querySBQX = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/querySBQX`, {
    params
  });

// 查询全部车系
export const getVehicleSeries = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/baseData/basicData/series`, {
    params
  });

// 获取登录人账号
export const getportal = params =>
  axios.get(`${SERVER.DMSCLOUD_BASEDATA}/portal/getPortal`, {
    params
  });

// 查询打印召回记录单数据
export const seletrecall = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/seletrecall`, { params });

// 获取外部系统地址
export const exGetUrl = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/system/geturl`, { params });

// 根据工单号查询fd上传状态
export const queryFdUploadStatusByRoNo = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/getFDInfoByOrder/${params.roNo}`, { params });

/**
 * 重构新增部分
 */

// 查询在修工单列表
export const queryOrderList = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repair/searchRepairOrder`, { params });

// 维修开单保存
export const saveRepairOrder = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/saveRepairOrder`, params);

// 查询附加项目列表
export const queryRoAddItem = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryRoAddItem`, { params });

// 根据工单号查询工单详情
export const queryRepairOrderDetail = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryRepairOrderDetail`, { params });

// 查询监控信息内所有数据
export const queryMonitorInfo = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryMonitorInfo`, { params });

// 本地维修历史查询
export const queryLocalRepairHistory = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryLocalRepairHistory`, { params });

// 查询本地维修历史明细
export const queryLocalRepairHistoryDetail = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryLocalRepairHistoryDetail`, { params });

// 本地历史维修项目查询
export const queryLocalRepairLabour = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryLocalRepairLabour`, { params });

// 本地维修材料历史查询
export const queryLocalRepairPart = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryLocalRepairPart`, { params });

// OEM维修历史查询
export const queryOEMRepairHistory = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryOEMRepairHistory`, { params });

// OEM维修历史详情
export const queryOEMRepairHistoryDetail = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryOEMRepairHistoryDetail`, { params });

// 获取维修建议列表
export const queryRepairSuggest = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryRepairSuggest`, { params });

// 查询维修套餐
export const findRepairSetMeal = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findGroupItem`, { params: { ASSEMBLE_STATUS: 10031001, ...params } });

// 根据套餐代码查询套餐项目
export const qeuryLabourBySetMealCode = (code, name) => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findRepairProject/${code}/${name}`);

// 根据套餐代码查询套餐配件
export const qeuryPartBySetMealCode = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findRepairPart`, { params });

// 查询车辆可参加的活动列表
export const queryVehicleActivity = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryVehicleActivity`, { params });

// 根据活动id查询活动详情
export const queryActivityDetailById = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpMa/getByMaId`, { params });

// 工单作废
export const discardRepairOrder = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/discardRepairOrder`, params);

// 工单打印接口
export const printRepairOrder = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/printRepairOrder`, { params });

// 根据vin查询车辆是否终身质保
export const queryVehicleWarranty = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryVehicleWarranty`, { params });

// 根据vin手机号查询用户是否注册app
export const getUserByVinAndMobileFromJH = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/getUserByVinAndMobileFromJH`, { params });

// 根据工单号查询工单审核信息
export const queryRepairOrderAuditResult = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/order/repairOrder/queryRepairOrderAuditResult`, { params });

//经销商翻译
export const byAllTranslate = params => axios.get(`${SERVER.CMSCLOUD_CHANNEL}/message/dealerAttach/dealerInfo/byAllTranslate`);

// af选择vin调用接口生成车档客档
export const licenseForAF = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/order/repair/licenseForAF`, params);

// 根据vin查询车辆是否终身质保
export const queryVehicleSpecialByVin = params => axios.get(`${SERVER.DMSCLOUD_ACTIVITY}/ttRpVehicleWarranty/queryVehicleSpecialByVin`, { params });
